<?php
/**
 * RedCross Application
 *
 * @copyright Copyright (c) 2010, Kristian Stokke Tryggestad, Rune Vikestad, Andreas Flaten Wist, Simen Nicolai Echholt, Ole Henrik Jahren
 */


/**
 * Base class for sending mail within the RedCross application.
 *
 * @category RedCross
 * @package RedCross_Mail
 */

class RedCross_Mail_Base extends Zend_Mail
{
	/**
	 * Constructor
	 */
	public function __construct()
	{
		parent::__construct('UTF-8');
		$this->setHeaderEncoding(Zend_Mime::ENCODING_QUOTEDPRINTABLE);
	}

	/* FIXME: should we use quoted printable encoding instead?? */
	public function setBodyText($text, $charset = 'UTF-8',
		$encoding = Zend_Mime::ENCODING_8BIT)
	{
		return parent::setBodyText($text, $charset, $encoding);
	}

	public function addPdf($file, $data)
	{
		$pdf = new Zend_Mime_Part($data);
		$pdf->type = 'application/pdf';
		$pdf->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
		$pdf->encoding = Zend_Mime::ENCODING_BASE64;
		$pdf->filename = $file;

		return $this->addAttachment($pdf);
	}

}
